<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>待打印电影票信息</title>
</head>

<body>
    <table>
        {volist name="data" id="vr" key="vk" empty="暂时没有要下载的电影票" }
        <tr>
            <td>{$vr["layout_id"]}</td>
            <td>《{$vr["movie_name"]}》</td>
            <td>上映日期：{$vr["release_date"]|strtotime|date='d/m/Y',###}</td>
            <td>上映时间：{$vr["release_time"]}</td>
            <td>
                <a href="" id='{$vr["layout_id"]}_{$vr["row"]}_{$vr["col"]}'>下载电影票TXT</a>
            </td>
        </tr>
        {/volist}
    </table>
    <script src="__STATIC__/js/jquery-3.4.1.js"></script>
    <script>
        $(function() {
            $('a').on("click", function(e) {
                e.preventDefault()
                var id = $(this).attr("id");
                $.ajax({
                    type: "post",
                    url: "{:url('cinema_ticket/down_link','','')}",
                    data: {
                        id: id
                    },
                    success: function(result) {
                        if (result.code == 1) {
                            alert("下载成功")
                        } else {
                            alert("下载失败");
                        }
                    }
                });
            })
        })
    </script>
</body>

</html>